package main

import (
	"encoding/json"
	. "gomysql/database"
	"io"
	"net/http"
)

func main() {
	http.HandleFunc("/bar", func(w http.ResponseWriter, r *http.Request) {
		res, _ := M("db0").Select("id,title").From("article").Limit(10).GetAll()
		tt, _ := json.Marshal(res)
		io.WriteString(w, string(tt))
		//fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
	})

	http.ListenAndServe(":8080", nil)

}
